<?php
/**
 * 课程修改添加表单数据保存到数据库中
 */
include "../util/DBUtil.php";
include "../util/PromptAction.php";

$id = $_POST['id'];
$course = $_POST['course'];
$sql = "";
$params=array();
if ($id==""){//添加
    $sql = "insert into tb_course(course) value(?) ";
    $params = array($course);
}else{//修改
    $sql = "update tb_course set course=? where id=? ";
    $params = array($course,$id);
}

$db = new DBUtil();
$statue = $db->update($sql,$params);
showStatue($statue);
echo "<script>window.open('../view/course.php','info');</script>";